All Questions
68 questions
0votes
2answers
150views
How to write an alias or bash script that renames a single file using the same syntax as the `ren` command of Windows?
I am a long-term a Windows user, so I find the syntax of the ren command both simple and convenient: ren C:\pathTo\myFile\oldFileName.txt newFileName.txt [Update 24 July 2024] To be clear about my ...
0votes
1answer
88views
Why does find ....-execdir rename miss files? zsh
I'm using zsh on MX Linux 23.2. For years I have tried to figure out why a command like find . -depth -type f -execdir rename 's/_720p//' {} \; skips over files. I know my file manager can't be ...
0votes
2answers
221views
Remove invalid characters from recursive Linux filesystem
I have a huge filesystem full of folders/files using invalid characters. I have found one command that almost does what I want and it came from this thread - https://stackoverflow.com/questions/...
0votes
2answers
60views
How to combine files from incrementing directories into one directory
I have a directory structure that follows this kind of pattern: - Dir 01 (Disc 1) \ - Dir 01 (Disc 1).iso - Dir 01 (Disc 2) \ - Dir 01 (Disc 2).iso - Dir 01 (Disc 3) \ - Dir 01 (Disc 3).iso - ...
1vote
2answers
199views
How do script a file rename functions to remove random character suffix
I have a bunch of files that had random characters added to the filename. I want to batch rename them original filename less the added characters all within the same directory. Example: From: foobar....
-1votes
1answer
59views
Rename 2 files using shell script
I created a script called rename_2_files.sh: #!/bin/sh #_start while getopts o: flag do case "${flag}" in o) OPTION=${OPTARG};; esac done # declare variable RENAME ="rename&...
3votes
5answers
2kviews
How to remove spaces at the end of folder names?
I would like to delete the spaces at the end of my folder names. I have a folder called "Project1 " in which I have another folder called "Exercise1 ". I want to use a script to ...
1vote
2answers
521views
Reordering substrings in a filename while renaming files in bash?
I have several hundred files, all with names following the same template : results_20210503_input003_run017_cluster003.txt Is their en efficient way in bash to reorder the substrings ? ...
0votes
0answers
26views
Save renamed name as variable [duplicate]
I am using Gammu for receiving SMS. Once received I am sending them as emails. Yet if sender ID of the SMS contains space, my script is unable to process a file. I.e.: If the file name is ...
1vote
1answer
84views
(perl) Rename bulk files - moving section starting with #{NUMBER} to front
I am trying to rename many files with the example formatting using rename with perl scripting 'Balisong Tutorial - (0g Chaplin) - Advanced #21-d8ajkHL34s0.mkv' 'Balisong Tutorial - (ALT Reverse Behind ...
0votes
0answers
39views
Renaming files based on the contents of a text file outside
I have a file which contains the filenames and the rename detail. When i am using this script from the folder its running fine, but when I am trying to run it from outside I am getting error. mv ...
1vote
3answers
95views
I need to rename folders, the new names are in txt files inside each folder
I would need some help. I have a bunch of folders, with non-descriptive names. Inside each folder, there is a "info.txt" file with several lines, but I'm interested in two of them: artist = ...
2votes
2answers
61views
Renaming file name with shell script
I have lots of file name like below; KO.ADVT..HHE.D.2017.163.121959.SAC KO.ADVT..HHN.D.2017.163.121957.SAC KO.ADVT..HHZ.D.2017.163.121959.SAC KO.ARMT..HHE.D.2017.163.121957.SAC KO.ARMT..HHN.D.2017.163....
0votes
0answers
127views
Script acts differently in different directories
I have a simple script that I pulled out of a larger script dedicated to renaming files with odd characters in the name. I have run this successfully on the same machine within different directories, ...
0votes
2answers
386views
Renaming files by removing delimited substring
I have a lot of folders and subfolders with files with name 1. Introduction--- [ FreeCourseWeb.com ] ---.mp4 I want to rename all files recursively (folders and subfolders) to just 1. Introduction.mp4 ...